package javaCode.chapter14.customgeneric;

/**
 * @author 徐州城
 * @version 1.0
 */
public class CustomGenericExercise {
    public static void main(String[] args) {

        MyGeneric<Double, String, Integer> mG = new MyGeneric<>("徐州城~~");

        mG.setT(10.9);
        //mG.setT("yy");//错误，T为Double类型
        System.out.println(mG);

        MyGeneric myGeneric = new MyGeneric("john~~");
        myGeneric.setT("yy");
        System.out.println("myGeneric=" +myGeneric);
    }
}

class MyGeneric<T, M, R>{
    String name;
    T t;
    M m;
    R r;

    public MyGeneric(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public M getM() {
        return m;
    }

    public void setM(M m) {
        this.m = m;
    }

    public R getR() {
        return r;
    }

    public void setR(R r) {
        this.r = r;
    }
}
